home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group93b.txt
/
000101_icon-group-sender _Mon May 17 17:46:22 1993.msg
< prev
next >
Wrap
Internet Message Format
|
1993-06-16
|
4KB
Received: from owl.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Mon, 17 May 1993 09:19:17 MST
Received: by owl.cs.arizona.edu; Mon, 17 May 1993 09:19:15 MST
Date: Mon, 17 May 93 17:46:22 +0200
From: karczma@univ-caen.fr (Jerzy Karczmarczuk)
Message-Id: <9305171546.AA02842@univ-caen.fr>
To: icon-group@cs.arizona.edu
Subject: Re: Icon vs Prolog?
Status: R
Errors-To: icon-group-errors@cs.arizona.edu
Boris Borcic asked:
>>I have read in this group that Icon uses a backtracking
>>mechanism very similar to Prolog. Would a user of both
>>languages care to sketch Icon with Prolog as background ?
>>What are the most significant differences ?
... and Dave Schaumann <dave@cs.arizona.edu> replied
> Probably the most significant difference is that Icon is a (mostly)
> imperative language. Thus, most Icon programs tend to be (mostly)
> imperative.
...
> It's been a long time since I did any Prolog programming, so I can't
> speak directly to the relative strengths of each language, but I wouldn't
> be to surprised if one could write a fairly complete Prolog interpreter
> in Icon with relatively few lines of code (particularly since you have the
> backtracking feature "for free").
* * *
Gentlemen, as you know, the discussion about programming languages is
like the old machos's memoirs about women: they are all the same, but it
is better not to replace one by another too often, if you want really to
learn something.
Actually I would call Icon rather a functional language than imperative.
1. Everything is an expression, the assignment and other control
structures included. (Well, OK, ALMOST everything, I know...)
2. You can store procedure (identifiers) and pass them as data, and then
call them anywhere.
3. You can define local lexical closures, or "thunks", and calling them
"co-expressions" doesn't change much.
4. co-exs (as generators) can be used to implement streams and other
lazy structures, so you are not too far from Lazy Functionalists.
Btw., this is a fascinating project for your students!
It is probably easier to implement Prolog in Icon than in Lisp, but
I wouldn't say that the Prolog backtracking is for free. You have to take
into account that implementing Prolog means installing data structures
which will emulate Prolog variables. And the backtracking in Prolog is not
just the control backtracking, but total data amnesia as well. It is not
straightforward to implement, but if you know the rules, you don't need the
non-deterministic facilities in the implementation language.
I would not agree completely with Richard Goerwitz who claims ... that
in Icon ...
> You can write programs
> that function solely by something analogous to term unification,
> and the like.
A. Don't forget that unification is a two-way pattern matching, absent
in Icon, unless the concept of "something analogous" is somehow
abused.
B. It is difficult to rewrite in Icon some Prolog clauses which profit
from the fact that you can store a non-instantiated variable, and
instantiate it afterwards. Sometimes it is possible, as de-referencing
in Icon is deferred, and the concept of datum which is VARIABLE
exists, but how many Icon users understand well the need and the
usage of the "." operator? (Frankly, I don't...)
(Just for the Guru himself: I think it is a light perversion to use for
the dereferencing operator the same symbol which has been used in Snobol4
to denote just the reverse of it, i.e. 'name'...)
Anyway, I love both languages (and a dozen others as well, like an old
programming-language Don Juan) and living (for some time) in France, the
country which is the mother of such international calamities as Prolog,
Armagnac, Eiffel (the language and the tower, don't know which one is
uglier...)
I permit myself to shout: "Vivent les petites differences!"
Jerzy Karczmarczuk Dept. of Computer Sci.
University of Caen, France
karczma@univ-caen.fr